package com.shengchang.hu.supervision.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.shengchang.hu.supervision.R;
import com.shengchang.hu.supervision.Utils.BaseViewHolder;


public class GridViewAdapter extends BaseAdapter {
   public Context mcontext;
  public   int[] icon={R.drawable.shouji,R.drawable.ruku,R.drawable.chuku,R.drawable.bulou,R.drawable.yijian,R.drawable.shuaka

    };
   public String[] iconnames={"院内收集","一键入库","退出登录","胎盘收集"
   };


    public GridViewAdapter(Context mcontext) {
        super();
       this.mcontext=mcontext;

    }

    @Override
    public int getCount() {
        return iconnames.length;
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView= LayoutInflater.from(mcontext).inflate(R.layout.gridview_item, parent,false);
        }
        ImageView  im=BaseViewHolder.get(convertView,R.id.img);
        TextView  text=BaseViewHolder.get(convertView,R.id.text);
        im.setBackgroundResource(icon[position]);
        text.setText(iconnames[position]);

        return convertView;
    }
}
